<?php
/**
 * $Id$
 *  @package	Joomla
 *  @author Daniel Eliasson
* 	@copyright	Copyright (C) 2010 Stilero. All rights reserved.
* 	@license	GNU/GPL, see LICENSE.php
* 	Joomla! is free software. This version may have been modified pursuant
* 	to the GNU General Public License, and as distributed it includes or
* 	is derivative of works licensed under the GNU General Public License or
* 	other free or open source software licenses.
*/

// no direct access
defined('_JEXEC') or die('Restricted access'); 

	$script = '<!--
		function validateForm( frm ) {
			var valid = document.formvalidator.isValid(frm);
			if (valid == false) {
				// do field validation
				if (frm.email.invalid) {
					alert( "' . JText::_( 'Please enter a valid e-mail address.', true ) . '" );
				} else if (frm.text.invalid) {
					alert( "' . JText::_( 'CONTACT_FORM_NC', true ) . '" );
				}
				return false;
			} else {
				frm.submit();
			}
		}
		// -->';
	$document =& JFactory::getDocument();
	$document->addScriptDeclaration($script);
	
	if(isset($this->error)) : ?>
<tr>
	<td><?php echo $this->error; ?></td>
</tr>
<?php endif; ?>
<tr>
	<td colspan="2">
	<br /><br />
	<form action="<?php echo JRoute::_( 'index.php' );?>" method="post" name="competitionForm" id="competitionForm" class="form-validate">
		<div class="competition_application<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
			<label for="contestant_name">
				&nbsp;<?php echo JText::_( 'Enter your name' );?>:
			</label>
			<br />
			<input type="text" name="name" id="contestant_name" size="30" class="inputbox" value="<?php echo $this->name;?>" />
			<br />
			<label id="contestant_emailmsg" for="contestant_email">
				&nbsp;<?php echo JText::_( 'Email address' );?>:
			</label>
			<br />
			<input type="text" id="contestant_email" name="email" size="30" value="<?php echo $this->email;?>" class="inputbox required validate-email" maxlength="100" />
			<br />
			<label for="contestant_link">
				&nbsp;<?php echo JText::_( 'Link' );?>:
			</label>
			<br />
			<input type="text" name="linkurl" id="contestant_link" size="30" class="inputbox" value="<?php echo $this->linkurl;?>" />
			<br /><br />
			<label id="contestant_comment" for="contact_text">
				&nbsp;<?php echo JText::_( 'Enter your message' );?>:
			</label>
			<br />
			<textarea cols="50" rows="10" name="text" id="contestant_text" class="inputbox required"><?php echo $this->text;?></textarea>
			<br />
			<br />
			<button class="button validate" type="submit"><?php echo JText::_('Send'); ?></button>
		</div>

	<input type="hidden" name="option" value="com_vmcompetition" />
	<input type="hidden" name="view" value="vmcompetition" />
	<input type="hidden" name="compid" value="<?php echo $this->competitions->id?>" />
	<input type="hidden" name="task" value="compete" />
	<?php echo JHTML::_( 'form.token' ); ?>
	</form>
	<br />
	</td>
</tr>
